<template>
  <div id="app">
    <van-button type="primary">主要按钮</van-button>
    <van-button type="info">信息按钮</van-button>
    <van-button type="default">默认按钮</van-button>
    <van-button type="warning">警告按钮</van-button>
    <van-button type="danger">危险按钮</van-button>
    <router-view />
    <van-cell title="选择单个日期" :value="date" @click="show = true" />
    <van-calendar v-model="show" @confirm="onConfirm" />
  </div>
</template>
<script>
import request from './utils/request'
import { setToken } from './utils/storage'
export default {
  created () {
    request.post('/user/login', {
      username: 'web84',
      password: '123123'
    }).then(res => setToken(res.data.data.token)
    )
  },
  data () {
    return {
      date: '',
      show: false
    }
  },
  methods: {
    formatDate (date) {
      return `${date.getMonth() + 1}/${date.getDate()}`
    },
    onConfirm (date) {
      this.show = false
      this.date = this.formatDate(date)
    }
  }
}
</script>

<style lang="less"></style>
